{% extends "GairalAdminBundle::layout.html.twig" %}

{% block bodyAdmin %}
<section id="travelAdmin" class="content">
    <div class="row-fluid">
        <table class="table table-striped table-condensed">
            <caption>
                <h4>Travels</h4>
            </caption>
            <thead>
                <tr>
                    <th>Travel place</th>
                    <th>Map</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="3">
                        <div class="btn-toolbar text-center">
                            <a href="{{ path('AdminTravelAdd')}}" class="btn btn-large btn-primary">
                                Add new Travel
                                <i class="icon-white icon-plus"></i>
                            </a>
                        </div>
                    </td>
                </tr>
    {% for travel in listTravels %}
                <tr>
                    <td>{{ travel.place }}</td>
                    <td><img src="http://maps.googleapis.com/maps/api/staticmap?center={{ travel.lat ~ ',' ~ travel.lon }}&amp;zoom=8&amp;size=200x100&amp;sensor=false&amp;ke=AIzaSyBgEBuVXPiUY55ap-UneZtC6cvBVnez7DQ&amp;markers={{ travel.lat ~ ',' ~ travel.lon }}" alt="{{ travel.place }}"/></td>
                    <td>

                        <div class="btn-toolbar">
                            <div class="btn-group">
                                <a href="{{ path('AdminTravelModify', {'id': travel.id})}}" class="btn btn-small btn-inverse">
                                    Edit
                                    <i class="icon-white icon-edit"></i>
                                </a>
                                    {% if travel.displayOrder != maxOrder %}
                                <a href="{{ path('AdminTravelUp', {'id': travel.id})}}" class="btn btn-small">
                                    <i class="icon-arrow-down"></i>
                                </a>
                                    {% endif %}
                                    {% if travel.displayOrder > 0 %}
                                <a href="{{ path('AdminTravelDown', {'id': travel.id})}}" class="btn btn-small">
                                    <i class="icon-arrow-up"></i>
                                </a>
                                    {% endif %}
                            </div>
                            <a href="#remove_{{travel.id}}" data-toggle="modal" class="btn btn-small btn-danger">
                                Remove
                                <i class="icon-white icon-trash"></i>
                            </a>
                        </div>

                        <div class="modal hide" id="remove_{{travel.id}}">
                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                <h3>Remove Travel</h3>
                            </div>
                            <div class="modal-body alert">
                                <p>
                                    Are you sure to want to remove the Travel: "{{ travel.place }}" ?
                                </p>
                            </div>
                            <div class="modal-footer">
                                <a href="{{ path('AdminTravel') }}" class="btn btn-info" data-dismiss="modal">
                                    Cancel
                                </a>
                                <a href="{{ path('AdminTravelRemove', {'id': travel.id})}}" class="btn btn-danger">
                                    Remove
                                    <i class="icon-white icon-trash"></i>
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
    {% else %}
                no travel
    {% endfor %}
            </tbody>
        </table>
    </div>
</section>
{% endblock %}